/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author PARINYA
 */
@Entity
@Table(name = "m_doctor")
@NamedQueries({
    @NamedQuery(name = "MDoctor.findAll", query = "SELECT m FROM MDoctor m"),
    @NamedQuery(name = "MDoctor.findById", query = "SELECT m FROM MDoctor m WHERE m.id = :id"),
    @NamedQuery(name = "MDoctor.findByName", query = "SELECT m FROM MDoctor m WHERE m.name = :name"),
    @NamedQuery(name = "MDoctor.findBySurname", query = "SELECT m FROM MDoctor m WHERE m.surname = :surname"),
    @NamedQuery(name = "MDoctor.findBySex", query = "SELECT m FROM MDoctor m WHERE m.sex = :sex"),
    @NamedQuery(name = "MDoctor.findByCode", query = "SELECT m FROM MDoctor m WHERE m.code = :code")})
public class MDoctor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Basic(optional = false)
    @Column(name = "Name")
    private String name;
    @Basic(optional = false)
    @Column(name = "Surname")
    private String surname;
    @Basic(optional = false)
    @Column(name = "Sex")
    private boolean sex;
    @Basic(optional = false)
    @Column(name = "Code")
    private String code;
    @OneToMany(mappedBy = "mDoctor")
    private Collection<SrvCureservice> srvCureserviceCollection;

    public MDoctor() {
    }

    public MDoctor(Long id) {
        this.id = id;
    }

    public MDoctor(Long id, String name, String surname, boolean sex, String code) {
        this.id = id;
        this.name = name;
        this.surname = surname;
        this.sex = sex;
        this.code = code;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public boolean getSex() {
        return sex;
    }

    public void setSex(boolean sex) {
        this.sex = sex;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Collection<SrvCureservice> getSrvCureserviceCollection() {
        return srvCureserviceCollection;
    }

    public void setSrvCureserviceCollection(Collection<SrvCureservice> srvCureserviceCollection) {
        this.srvCureserviceCollection = srvCureserviceCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MDoctor)) {
            return false;
        }
        MDoctor other = (MDoctor) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.MDoctor[id=" + id + "]";
    }

}
